Juce Demo File Playback not playing music

I’ve tried a fair amount of times changing the sample rate in the setsource parameters. But when I run the demo and click the play button, it doesn’t work.

Does anyone know which part of the demo might be the problem?

Very hard to guess what you’ve done wrong from only a description of what you were trying to do…

Speakers not turned on…? :wink:

I was just trying to playback a song file like what the playback demo was supposed to do, didn’t get any sound.

Very unlikely that anyone can help based on a question like this without more solid info.

In the big juce demo. There’s a file playback demo, which reads audio files and allows you to play them. So I checked that out. Chose my audio file; the file playback demo displayed the audio waves patterns. And there there was a play button to play the selected audio file. I pressed that, I even waited one minute, and it still doesn’t play. Had my speakers on, cranked upthe system’s volume. No audio.

Ah ok, thought you were talking about your own code.

Well, the demo certainly works on all the devices we’ve tested, what are you running on? Have you tried tweaking the audio settings for sample rate, output device etc?

1 Like

I’m run vs 2015 with juce on win 7. I did try tweaking the sample rate; 48000 was what my speakers rate (is bitrate and samplerate the same thing?). There is this audio settings demo thing in the big demo, is that part of the file playback demo?

Actually I figured it out! It was the Audio settings demo. I just had to set the output to my speakers! :slight_smile:

1 Like

I also am unable to play the files, though I can see the thumbnails, while using AudioPlaybackDemo from the Examples folder in the ProJucer. This is with JUCE 5.3.2 and MS VS2017. I have no problem playing files using the tutorial “PlayingSoundFiles” however. The only difference I can see is that the demo inherits from Component instead of from AudioAppComponent. I tried running the Settings example, which does produce a sine tone after I select my audio device. But the PlayingSoundFiles works without the need to run a Settings dialog. I am curious as to why.

I also just noticed that if I run AudioSettings demo from Examples within the ProJucer instead of exporting to MS VS 2017, that the ProJucer crashes.

I can’t reproduce either of these on Windows 10, VS2017. Are you using the latest tip of the develop branch?

Hi Ed. Thanks for your response. I’m using JUCE 5.3.2 with MS VS Express 2017 version 15.7.1 (MS .NET v 4.7.02558) in a Windows 8.1 environment. I’m not sure what you mean by the latest tip of the develop branch, so I can’t answer that question.

It could be an issue with your audio device settings - can you try running the DemoRunner application and seeing if the example works there? You should be able to change the audio device settings via the “Settings” tab.

The program works correctly in Demo Runner. There was no need to visit audio device settings to get it working.

Bumping this problem up as I’m getting the same out of the box fail. I’m on Visual Studio 2019. The playback demo plays in the demo runner, it also plays if I build the demo runner code, but if I create/build a project for playback using projucer and try to play a file, it won’t play the file (wav or mp3). It will load the file, and show the visual of file- I can zoom in/out, but if you press play it doesn’t start/move.

I’ve tried switching default audio devices on the target machine as well. I am sort of dubious that its device selection because when I run playback in the demo runner, I get playback w/out resetting the devices. I also went and built the plucked strings code outside of the demo runner to validate I could get audio out of a speaker.

In walking through the debugger I’m not seeing any spots where the code is getting bad return values from anything…though I’m about to have a long conversation with the code to figure it out.

Thought I’d post this in case anyone else has seen/tried it/figured it out.

Resolved: It has everything to do with the audio device settings… the demo code doesn’t grab an output device by default . Even though the demo runner does find a device w/out you selecting it, the code might not in stand alone might not. —A---- solution is to code in in the audioSetupComp.

I did this in about 15 minutes by removing the file directory chooser to make space for it in the UI and added it to the top. If you don’t know how to do that, go review the audiosettings demo code.