Getting sound close to bare metal


#1

Anyone know how to build an audio app just using an OS API and some clever array trickery? I want to know how to build digital audio without necessarily using JUCE as a crutch.


#2

Why? What do you think you are going to achieve by writing that awful low level code yourself? (And yes, I’ve written a C++ abstraction layer over Windows WASAPI, there’s nothing fun or useful in doing that.)


#3

An experience. I want to experience things as low level as possible as an exercise in understanding how JUCE works. If you are able to steer me toward doing it the old fashioned way I’d like to use a Windows system API and the STD library, using visual studio and the Audio Programming Book.


#4

I personally feel that learning impractical low level things such as assemblers and OS and what not is a really good educational experience even though it may not be the most productive. Educational experiences and deeper understandings to me are just as important. I don’t want to be script kiddy in this context.


#5

Perhaps try http://www.portaudio.com/ it’s quite comprehensive and can be a nice dive down.


#6

A few years ago I wrote an oscillator and a few other components for an AVR microcontroller in assembler. I won’t lie, it was a painful experience and a baptism of fire. But it does the job if you really want to figure out what lies beneath - which was kinda my reasons for doing it too. Pretty enlightening when it comes to optimising your code/algo.


#7

Assembly language is a joyous thing, especially when you can see it running lightning fast.
Embrace the nerd, don’t shy away from it - or we’ll all end up ‘waving a hand at a robot’ and calling that programming! And that 'll be a fine mess… :slight_smile:


#8

Augmented Reality Software Development is just around the corner!


#9

Great! I’d love to learn x86 assembly if I knew how to to use it for audio. I know I need to to reach the DAC directly… JUCE and apis abstract this layer which is kind of the point of this exercise.


#10

I have the Audio programming book. I just never understood how to access the correct hardware and set aside memory and what not to get sound. PortAudio looks like good start as well as SDL, but I want to almost be machine specific to get the most out of audio programming at a fundamental level.


#11

Good luck with that with general purpose operating systems like Windows, macOs or Linux…


#12

Those have nothing to do with “bare metal”. They are just abstractions over the operating system abstractions that themselves use the device drivers. So PortAudio and SDL do pretty much what JUCE does, but they are more inconvenient to use because they are in C and not C++.


#13

Yeah, you’re probably better off going with simpler hardware if you want that level of access - a microcontroller, a dev board or something similar. If you just want to access the audio thread and write samples to the output buffers, there’s plenty of ways to do that with a modern OS. But if you’re looking for really low-level access, which it sounds like you are, then a microcontroller will put a lot less in your way and offer you significantly more freedom, plus all of the headaches that come with that level of freedom.


#14

Okay so I want fundamental access to the audio thread without necessarily relying on too much of someone else’s code to make things happen. So you’re saying I can’t do anything without queries to the OS?


#15

JUCE gets the job done but I want to get the most out of building things from the ground up. Is there a way I could use an assembler to do this or? This is really important to me. I want to internalize the fundamentals of audio coding from scratch. Perhaps bare metal wasn’t really the right wording.


#16

just learn to read and understand the JUCE source code that interfaces with all the system-specific calls, and then learn to understand those system-specific calls.


#17

You can write all your DSP stuff super low level in assembler or C also with JUCE. I don’t understand why you want waste time with programming your own audio driver that only works for one specific audio device. As said before, an embedded board is maybe the best choice for you.


#18

But someone had to write it them in the first place. If you want to learn how drivers work, then why the hell not! You may want to ask somewhere else though. All you’re going to get here is a resounding “HUH!?” :smiley:


#19

So it’s drivers that I’m curious about then. Okay so I gotta find somewhere to look for that information. Anyone able to point me toward that ? I’m definitely using JUCE to get stuff built and on my CV/resume, but I want a little extra.


#20

I don’t know man, are you on Windows?..