Go Down

Topic: PDM library - where is the source code? (Read 635 times) previous topic - next topic

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:

https://github.com/adafruit/Adafruit_ZeroPDM

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.

ballscrewbob

#1
Oct 23, 2019, 01:54 am Last Edit: Oct 23, 2019, 01:57 am by ballscrewbob
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.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

Florin_Andrei

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:

https://github.com/adafruit/Adafruit_ZeroPDM

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.

Quote
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?

pert

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:

https://github.com/adafruit/Adafruit_ZeroPDM
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.

Is that it?
No.

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.

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:
https://github.com/arduino/ArduinoCore-nRF528x-mbedos/tree/master/libraries/PDM



Florin_Andrei

@pert - that was very helpful, thank you!


Quote
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!

pert

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.

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

Rosaku

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

Go Up