Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAudio: Adpcm stream relies on Windows.Media player #8

Closed
MaKiPL opened this issue Mar 5, 2019 · 7 comments
Closed

NAudio: Adpcm stream relies on Windows.Media player #8

MaKiPL opened this issue Mar 5, 2019 · 7 comments
Assignees
Labels
bug Something isn't working LINUX

Comments

@MaKiPL
Copy link
Owner

MaKiPL commented Mar 5, 2019

Find another way to play pre-converted sounds from NAudio adpcm to WavPCM

@MaKiPL MaKiPL added bug Something isn't working LINUX labels Mar 5, 2019
@MaKiPL MaKiPL self-assigned this Mar 5, 2019
@Sebanisu
Copy link
Collaborator

Sebanisu commented Mar 12, 2019

I thought I fixed this but i just ran it in linux and realized the function that wasn't working i was using WaveStream a = WaveFormatConversionStream.CreatePcmStream(raw); and that is the thing you are talking about. I did remove the need for waveout which I thought that was what this was referring too.

@MaKiPL
Copy link
Owner Author

MaKiPL commented Mar 12, 2019

Yeah, that's mostly because PCMs are Windows natively supported. NAudio passes the PCM stream probably to IDirectSoundBuffer that doesn't exist on Linux. Recently I was working with FFMpeg. My idea is to use that instead of NAudio and let Monogame play the pre-converted sound, but FFMpeg is unmanaged type, so that might need a lot of marshaling. This will be for sure something I'll be working on after I finish battle stage camera + monster rendering

@Sebanisu
Copy link
Collaborator

I think my class can be made to read these and convert to pcm. After I got it to run on Linux I am planning to take a look at it.

@Sebanisu
Copy link
Collaborator

Sebanisu commented Apr 2, 2019

From what I gather if I don't pass data that will play in vlc or something it won't work. So I've been trying to learn how to format the raw adpcm wave data with a header in hopes that players will play it. using http://wiki.ffrtt.ru/index.php/FF8/FileFormat_FMT and http://icculus.org/SDL_sound/downloads/external_documentation/wavecomp.htm for reference and your working code. Maybe i should save a file using naudio and see what it does differently.

@Sebanisu
Copy link
Collaborator

Sebanisu commented Apr 2, 2019

http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html and this http://www.cplusplus.com/forum/beginner/166954/ kinda helped. Got code that write wav files now. woo! there still compressed. I think now I can swap the filestream for a memory stream then send that data to ffmpeg to decode it for playback. None of the software understood what it was without a properly formatted header.

@Sebanisu
Copy link
Collaborator

Sebanisu commented Apr 3, 2019

Okay I have sound playback working on linux. But, it's kinda a hack. I currently need to write the adpcm files to valid RIFF wav files. Then read then into ffmpeg the normal way. I had issues like I hard coded stereo and 44100 or 48000. So if anything was mono or another sample rate it wouldn't work. Decode() function didn't work with any files that were more than one frame per packet. Most of the adpcm files were multiple frames per packet. I still want to load the sound from memory instead of using the hard drive.

@Sebanisu
Copy link
Collaborator

Sebanisu commented Apr 3, 2019

Okay I have something functional that doesn't write wav files to play them. I'll close this and do a pull request. Might need optimizations. It plays in linux but it's a bit delayed on my virtualbox instance.

@Sebanisu Sebanisu closed this as completed Apr 3, 2019
Sebanisu added a commit that referenced this issue Apr 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LINUX
Projects
None yet
Development

No branches or pull requests

2 participants