adangert / JoustMania

Raspberry Pi Jousting at its finest
http://joustmania.com
Other
124 stars 34 forks source link

Audio stuttering when files initially loaded #182

Open martinbogo opened 5 years ago

martinbogo commented 5 years ago

On my Pi 3 B+, with a high-performance SanDisk SD card ( 128GB, formatted EXT4 )

When initially loading audio files, there is a "stuttering" during playback, where the audio is rendered glitchy the first time it is played. The second time it is played, there might be some caching involved because playback is quite smooth.

I think this is due to the default IO scheduler currently used by default in Raspbian Lite. I believe the default scheduler for the SD IO is CFQ, and should probably be set to the noop scheduler when booted.

/etc/udev/rules.d/60-mmc-scheduler.rules

# set noop scheduler for non-rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="noop"
# set noop scheduler for multimedia cards (SD-cards)
ACTION=="add|change", KERNEL=="mmc*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="noop"
adangert commented 5 years ago

are you using mp3s or wavs? also there recently was a bugfix that hopefully removes some stuttering, if you have the newest update.

martinbogo commented 5 years ago

Mostly Mp3's encoded 128kbit constant bitrate instead of VBR.

On Mon, Jan 14, 2019 at 9:11 PM Aaron Angert notifications@github.com wrote:

are you using mp3s or wavs?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/adangert/JoustMania/issues/182#issuecomment-454252282, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPVKQUJ5TCdzyI2aawsMnup7cV5I0d3ks5vDUb7gaJpZM4aAJxv .

adangert commented 5 years ago

Did the update fix it for your playback?

martinbogo commented 5 years ago

Unfortunately no. But when I switched IO schedulers to 'noop' it did fix the issue. I think its just that the new default IO scheduler in Raspbian Lite is not optimal when there's a lot of file IO going on after initial boot and initial loading of the files before they get cached by the kernel.

adangert commented 5 years ago

ok I'll see about changing that to be the default, just in case others install raspian lite, I use the desktop version of raspian so perhaps that's why I'm not seeing the issue.