PDM library - where is the source code?

I've a Nano 33 BLE Sense. I'm reading about the PDM sound library:

It's not clear which library this is. In IDE / Manage Libraries, the closest I see is the Adafruit Zero PDM library, with the GitHub repo here:

Is that it? Or is it a different library that's discussed on the first link, one that is owned by the Arduino project?

The API of the Adafruit library seems a little different from what I see on arduino.cc, based on the examples they include, which is why I'm asking.

In general - on the main library pages on arduino.cc please add links to the corresponding GitHub repos. You'll make life easier for your users.

You may want to learn how to use the library manager in the IDE.
It makes it quite simple to get the proper ARDUINO LIBRARIES and avoid ones that will not work.
It also negates hunting around github collecting libs just to see if one from somewhere else does work (OR NOT)

Also partly answered in the other post about the BLE SENSE.

Moving you to the correct section also.

Bob.

Additionally if you continue to scatter related issues randomly around the forum you may be subject to a time out.

Wow.

First off, that was pretty unhelpful.

Secondly... I'm not sure what I'm detecting here - a bit of attitude maybe? Seriously, this is how you treat people who bought your products and now are trying to figure out how to use them? "You may want to learn" before you speak - that sort of thing? Wow. That's some quality customer interaction.

I was simply trying to confirm whether the library discussed here:

https://www.arduino.cc/en/Reference/PDM

...is the same as the library hosted here:

There is only one library that appears in the Library Manager when searching for "PDM", and it's the Adafruit library (click the More Info link, you get sent to the Adafruit page on GitHub). I had some doubts whether it's the same as the library discussed on arduino.cc because the API seems a bit different.

I really like the idea behind the Nano 33 BLE Sense, but the product is plagued by a variety of issues. The COM port that's very flaky on Windows. The compilation issues. Documentation is sparse and examples are lacking. The whole experience is... not smooth, to say the least.

Now I'm trying to figure out how to use the onboard microphone, just to evaluate the level of ambient sound (no frequency analysis, just a simple loudness meter), and I can't find a single example for the PDM library that would do that.

So I ask a question on this forum, and I am told by a moderator that I "need to learn" before speaking. Yeah, thanks so much.

Additionally if you continue to scatter related issues randomly around the forum you may be subject to a time out.

Yes, because I'm new to this forum. I didn't even realize I was "scattering" things "randomly". If I did anything wrong, I apologize. But you need to realize that newbies may take a while to learn the rules of this place.

Wow.

Do you guys even want people to buy your stuff? Do you care?

1 Like

Florin_Andrei:
I've a Nano 33 BLE Sense. I'm reading about the PDM sound library:

https://www.arduino.cc/en/Reference/PDM

It's not clear which library this is. In IDE / Manage Libraries, the closest I see is the Adafruit Zero PDM library, with the GitHub repo here:

GitHub - adafruit/Adafruit_ZeroPDM: Arduino Library for using ATSAMD processors with PDM microphones (w/I2S)

You won't find the PDM library in the Library Manager because it is bundled with the Arduino nRF528x Boards hardware core. The reason is this is an architecture-specific library. It is updated along with the hardware core so it would not make sense to update or install it separately from the core using Library Manager.

Florin_Andrei:
Is that it?

No.

Florin_Andrei:
Or is it a different library that's discussed on the first link, one that is owned by the Arduino project?

Yes. The Adafruit library is a 3rd party library. Only official Arduino libraries are documented on the Arduino website.

Florin_Andrei:
In general - on the main library pages on arduino.cc please add links to the corresponding GitHub repos. You'll make life easier for your users.

The standard Arduino user is not interested in GitHub repositories so that might be the reason why they are not there. If you only want to look at the source code, it's much better to look at the files on your own computer so that you're certain the code you're looking at is what's being compiled.

Here's how you can find the source code of the PDM library on your computer:

  • Tools > Board > Nano 33 BLE Sense
  • File > Examples > PDM > PDMSerialPlotter
  • Sketch > Show sketch folder - this will open the folder that contains the PDMSerialPlotter example sketch
  • Navigate up two folder levels to the PDM folder.
  • Open the src subfolder of the PDM folder. This is where the library source code is.

It does make sense to post the repository link in case people want to contribute to the development work. I don't have the ability to do that, but I can give you the link here:

@pert - that was very helpful, thank you!

The standard Arduino user is not interested in GitHub repositories so that might be the reason why they are not there.

Examples are always useful. Which headers to #include? How to initialize the library? What's the context for some simple calls? One look at the example file in the repo you've indicated was more helpful to me than many hours of googling and just trying things randomly.

It was easier with all the other libraries I'm using in this project, because the More Info link in the library manager always sent me to a place where I could find examples, like a GitHub repo. But for PDM I could find no such thing - until you posted that URL.

It would be very helpful to just add a simple link at the bottom of the documentation page for each library of this kind: "examples - click here".

Anyway, that's just a suggestion.

For this project - now I have some PDM code compiled into the main source, and it looks like I'm actually getting signal. Time to figure out what to do with it. Thank you!

Florin_Andrei:
Examples are always useful. Which headers to #include? How to initialize the library? What's the context for some simple calls? One look at the example file in the repo you've indicated was more helpful to me than many hours of googling and just trying things randomly.

It was easier with all the other libraries I'm using in this project, because the More Info link in the library manager always sent me to a place where I could find examples, like a GitHub repo. But for PDM I could find no such thing - until you posted that URL.

It would be very helpful to just add a simple link at the bottom of the documentation page for each library of this kind: "examples - click here".

Of course examples are useful, but there is no need to look in the GitHub repository for that. You can open the library examples in the Arduino IDE at File > Examples > PDM.

Florin_Andrei:
Thank you!

You're welcome. I'm glad if I was able to be of assistance. Enjoy!
Per

Hi,

I just wanted to say I had the same exact issue.
I was unable to figure out how the PDM lib worked until I found the example as suggested.

It might be an idea to state that this example exists on the https://www.arduino.cc/en/Reference/PDM reference page

Florin_Andrei:
It would be very helpful to just add a simple link at the bottom of the documentation page for each library of this kind: "examples - click here".

Rosaku:
It might be an idea to state that this example exists on the https://www.arduino.cc/en/Reference/PDM reference page

I agree. The standard convention in the Arduino library reference pages is for the home page of the library reference to contain a list of links to the tutorials that go with each of the library's examples. No tutorial has been written for the PDM library's PDMSerialPlotter example, and it's clear that this is needed.

If you like, you can submit an issue report about this to bring it to the attention of the people at Arduino who can update the documentation accordingly:

Florin_Andrei:
Secondly... I'm not sure what I'm detecting here - a bit of attitude maybe? Seriously, this is how you treat people who bought your products and now are trying to figure out how to use them? "You may want to learn" before you speak - that sort of thing? Wow. That's some quality customer interaction.

You are not our customer. You are amongst friends who help each other. We are just having fun helping others with their projects. Have look around the forum and you will see that even though every forum has a "How to ask questions" section at the top, there are still a lot of post who fail to provide minimal information. That sometimes makes someone grumpy. You will see these sometimes-grumpy guys are really helpful.

Stick around, I feel you have the potential to become an old grumpy guy yourself. :slight_smile:

1 Like