Become a Creator today!Start creating today - Share your story with the world!
Start for free
00:00:00
00:00:01
295: MTrack & Mike's DIY Raspberry Pi Backing Track Player image

295: MTrack & Mike's DIY Raspberry Pi Backing Track Player

E295 ยท PodCast Them Down: Heavy Metal Nerdery
Avatar
17 Plays6 months ago

Mike discusses the Raspberry Pi backing track player he created and MTrack, the code that runs it.

MTrack: https://github.com/mdwn/mtrack

#mtrack #backingtracks #foss #livemusic #rust

PODCAST THEM DOWN - https://linktr.ee/pctd
https://patreon.com/podcastthemdown

Recommended
Transcript

Introduction and Episode Overview

00:00:00
Speaker
Five. Cast. Them. Down. Hey, Old Metal Nation. It is I, Tim. That's Mike. This is Podcast Them Down. And we're going to do one of our extremely popular, very technical episodes where we give an update on the goings on in hardware and software land.

Mike's Backing Track Mishap

00:00:25
Speaker
So you have created
00:00:28
Speaker
Okay, so hang on, let me back up. You blew up a backing track player. Yeah, and let me show you something. All right, so I got these CX or Chucks or something power, like pedalboard power supply. Chuck Taylors, the shoes? Chuck Taylors, yeah. You know CX, C-I-O-K-S, I don't know how it's pronounced. But they have a bunch of like kind of custom-ish wires that you can get.
00:00:58
Speaker
And one of them, so what I was toying with the idea of taking my, uh, somatic you, you track 24, which is a backing track multiplayer. So you load up, if you have all the stems for a song, I'm, I'm, I'm trying to think of who the audience is, like how much, how much background they need the, you know, like when you,
00:01:27
Speaker
hit play on your Spotify and you get left and right. Well, imagine you had 24 of those channels instead of just left and right, you had one through 24 and one is the kick drum and two is the snare drum and three and four are the drum overheads. And then five is guitar and six is another guitar and seven, you get the idea.

Challenges with Laptops for Backing Tracks

00:01:49
Speaker
That's what this does. It plays back a music file with up to 24 outputs and they're all isolated. So this is how bands do their backing track players. Cause it's a backing track player. Usually bands will use a laptop and an audio interface. This is kind of the, this is really how most bands do it. But if you're running your own tech,
00:02:21
Speaker
Personally, I find babysitting a laptop while playing guitar to be absolutely impossible. Most bands also put them back by the drummer, by the way. The drummer often has the laptop opened by him. But in case he's listening, no offense. But you need to be playing drums. You don't need to be worrying about the laptop.
00:02:45
Speaker
Yeah, I mean, unfortunately, I think Tim and I, well, in at least the band where a lot of this came from, recently Vacated Graves, Tim and I had the most tech awareness.

The Fall of Symatic and Mike's Solution

00:03:00
Speaker
So we ended up being like the tech people. And then I kind of took it over because I went crazy.
00:03:11
Speaker
with everything that I've done. But anyway, that aside, yes, backing track player just plays multiple channels of audio simultaneously. And CX has, they're basically very nice DC or AC to DC power supplies, usually for use.
00:03:40
Speaker
in pedal boards. But the Symatic U-Track 24 backing track player is powered by 15-volt DC, which the CX DC7 can do, but you need to put a few current doublers
00:04:01
Speaker
because there's kind of like a few outputs that can only do so many amps and you need more than one. And you can use a current doubler cable to do that. And this just, you plug into one output on the CX, you plug into another and then you get another output and then you can plug that directly. So I needed three, which is fine. However,
00:04:31
Speaker
This is a voltage doubler and this does something slightly different. Why? I believe that doubles voltage. Yes. And, um, that means that I put 30 volts into my Utrecht 24 and all of a sudden my Utrecht 24 started smoking. You let out the magic smoke.
00:04:56
Speaker
And I said, oh shit, what did I just do? And that's when I realized that this is not a current doubler, it's a voltage doubler. This is, by the way, this is the exact cable that fucked me. Why do you still have it? What if I need it? Now I know. Double some voltage and break something else. Yeah. Okay. So I did this right before our tour.
00:05:26
Speaker
which caused all sorts of issues. But we got through it. But the thing is, is that I had been worried about this scenario for an incredibly long time. I had talked to Tim about it multiple times. I talked with various people in the band. It's like, look, Symatic, the company that makes this backing track player is no more. They've ceased operation.
00:05:50
Speaker
So it's like there is a fixed number of these backing track players on the market. At a certain point, this will not be viable. I don't think that point is now. I could probably have just bought another one, but then I was like, all right. They are $600 and you definitely couldn't have turned it around for the tour. No, no, it would have been impossible. Like used ones are $600.
00:06:12
Speaker
Yeah. Like when I bought it, it was a thousand. So that's, it's coming down. Yeah. Oh, not yours. I bought it. I bought it new for a thousand. Here's one for $1,181 plus $111 in shipping. Oh, that's coming from like Japan. I'm checking. Yeah. Yeah. Now it's coming from Deutschland. Okay. All right. So long story short,
00:06:40
Speaker
I've been worried about this forever, so I said, okay, I'm going to write my own because I'm a nerd and I can. This is now released on GitHub. You can see this. It's not perfect. We've had issues gigging with it. I'm still trying to shake out the issues. However, it does work.
00:07:10
Speaker
I've written this thing called Amtrak. It runs, it's intended to be run on a Raspberry Pi and you can connect it to any audio interface and just playback audio. So I initially wrote this in Golang. We're really diving into. Yeah, yeah. No, no, no. This is the sound of more people turning the podcast on. Yeah. Okay. So, so I primarily Golang is a programming language.
00:07:40
Speaker
that I believe was kind of championed by Google, but it's very good at multithreading and concurrency. So doing multiple things at the same time. Because I use this day to day, I was like, I should probably, I'll just use this because this is, you know, this is, this is my bread and butter. I'll, I'll be able to do this fast.
00:08:07
Speaker
This is not necessarily incorrect. However, one of the issues is that audio playback, especially in Linux is kind of done through this also driver or also system, which is audio Linux something. I don't remember what it stands for anymore. I don't know. Let's put it in the read me. I'm reading reading me right now. Well, the thing is though, is that I don't use it directly now.
00:08:37
Speaker
Okay, so in Golang, I had to use kind of this ALSA subsystem. And there isn't really a Golang ALSA library. So I had to use raw C, which you can do from Go.
00:08:58
Speaker
And I did it. It's okay. I had some issues that I needed to work through, but the performance is heinous using Sego, or at least it was subpar for what I needed. And maybe I could have hatched through it. Maybe it was something that I could have tweaked easily. I'm sure if there are programmers listening to this that know more about this, they'd be like, oh, you did the wrong thing.
00:09:28
Speaker
But basically I was like, okay, maybe Go isn't the best choice here. So I did a very reasonable thing and I started, I was like, I'm going to use Rust.

Switching from Golang to Rust for Amtrak

00:09:39
Speaker
I don't know shit about Rust. I don't know the goddamn thing. Or I guess I do now, but I didn't when I started this. I was like, I'm just going to use Rust. I see on GitHub, this is a hundred percent in Rust. Yeah, it is 100% in Rust.
00:09:56
Speaker
Do I have the Go branch? No, I hit it. It's gone. There's no evidence of my Go iteration of this. But I was like, all right, let's use Rust. So before I did this, is there Rust audio libraries? And there are, and they're pretty good. So I kind of made sure that what I wanted to do existed first.
00:10:25
Speaker
Uh, because I, you can sit there and you can do everything using C, which is fine. But if it's like, if I'm, if I'm going to, if I'm going to wrap around C, I might as well just do it in C, which I used to program in a long time ago. But no, Russ looked like a pretty appropriate language and it's something I've been kind of curious about doing for awhile. So.
00:10:52
Speaker
I wrote this thing. It's got some issues.

Amtrak's Features and Gig Challenges

00:10:55
Speaker
Like I said, we were gigging with it last weekend and it stopped letting me go forward. And I checked, I have logs and they were empty. Oh shit. So I'm very annoyed. So now I'm going to have to spend some time trying to reproduce this.
00:11:19
Speaker
Could it have had something to do with all the fried hot dogs we had eaten? Maybe the grease got in the... I think that's it. I have a suspicion I know what it is, but I don't know... I have a suspicion I know the nature of the issue. I just don't know that I know... I don't know the exact issue, if that makes sense.
00:11:46
Speaker
But overall, I mean, I'm fairly happy with this thing. It does what it's supposed to do. And the idea is that you have a mini controller on a pedal board that you send me commands to the player and then you can navigate a playlist, start a song, stop a song, which is actually not something that I could easily do before. And, and again, it's a raspberry pie and there's no monitor and it's headless.
00:12:16
Speaker
It's a headless Raspberry Pi, yeah. If something goes wrong, you're sort of hosed, which is something I'm trying to wrestle with at the moment. So here's one of the interesting things. So with the cymatic, I'm pretty sure what happens, you have to use this
00:12:38
Speaker
You have to use their tool you tool, which I know that you've used because you have like the, I have the dumber cousin of the you track 24. It's like a you track 16 or something. Yeah. So I'm pretty sure what it does is it takes the wave files and like coalesces them into one multi-channel wave file and plays that I'm pretty sure. And I decided that I didn't, I sort of didn't like that.
00:13:09
Speaker
So I wrote my own, I don't know, maybe you'd call it like a wave file muxer. Like it takes the wave files and then interleaves them as PCM data. So for audio, like an audio interface, the way data is written, you could do it in a few ways, but I found that this is not
00:13:37
Speaker
I found that this seems to be more theoretical than actual. The PCM data is channel 1, channel 2, channel 3, channel 4, channel 5, channel 6 to channel N, and then the next sample, channel 1, channel 2, channel 3, channel 4.
00:13:56
Speaker
So it's everything interleaved over and over again. So at 44.1 k, at a 44.1 kilohertz sample rate, so that's 44,100 samples per second times the number of channels. And if you think about it, if you do this wrong, you could be moving a lot of data around, right?
00:14:25
Speaker
Basically what I've done is it reads N wave files, takes the channels from those wave files and then creates a PCM stream containing the samples in the appropriate order. So we have click drag. Yeah. If you skipped over like channel eight, you're not carrying around all those zeros anymore. You're putting them in when needed. Yeah. Yes.
00:14:53
Speaker
So, so yeah, I had to learn about PCM streams. She didn't know anything about before I had to learn rust, which is very interesting and very frustrating. I got there. I tried to do a little bit of smarts, which I ended up stripping out because it was like, not, not really, not really doing what I wanted it to do in terms of what I'm doing.
00:15:22
Speaker
Under the covers, there's two libraries I'm using. I'm using CPAL. I don't know what it stands for, but it's a Rust audio library. Let's see. Cross-platform audio. Library. Library. Perfect. And the next one I'm using is actually not particularly
00:15:49
Speaker
well used, but I kind of went over it. I was like, you know what? This looks, this looks good. It's called NODI. N O D I.
00:16:00
Speaker
This is for MIDI. So it's this very kind of, oh, nice. He's still updating it, which I'm happy about. It basically uses MIDIR or MIDIR or whatever, which is another Rust library to do real-time MIDI playback. So here's something that's interesting. MIDI files, as you read them, they have like, in terms of their file format, they contain just a bunch of ticks, right?
00:16:31
Speaker
There are some variances, but I think for the most part, this is how most of them are defined. So it's like start point, I have this many ticks per minute. Tick, tick, tick, tick, tick, tick, tick, tick. So if you want to play this back in real time, you basically need to play everything that should have been played in the last tick. Wait that specific amount of time.
00:17:01
Speaker
play everything, wait that specific amount of time, play everything, yada, yada, yada. And the ticks are actually finer grained than what some operating systems will allow you to sleep for, which is okay. Cause you can busy sleep instead, but that eats up CPU time and it's unpleasant. So,
00:17:30
Speaker
What I was I was going to write my own before I stumbled on this. And after looking at it, it's like this really though it's not a very popular library, it's like this is actually fine. So he has basically a ticker that waits the appropriate amount of time in between each.
00:17:50
Speaker
MIDI tick and then plays out to Meteor midi are whatever it is and It works. So I've used it. It works Everything seems to work. The issue now seems to be more like consistency So like I said with During her last show it just ceased working and I
00:18:16
Speaker
I know it was like getting info, so I don't know why it stopped, but it's hard to write automated tests for this because you need an actual audio interface. So I'm sort of looking into how I can emulate that because there is like a null, there are no audio interfaces that you can load and also could potentially do that.
00:18:43
Speaker
But yeah, so if you're interested, I guess I gave a link to Tim. In the thing, you can download it. You can submit issues. He can complain to them. Yeah. I'm sure my rust is awful. So feel free to correct me. Uh, yeah, but that's about it. Yeah. It's been interesting. I've had to learn quite a bit of stuff.
00:19:08
Speaker
Is this the, was it worth saving $600? Truthfully, yes to me, because once I get this kind of more dialed in,
00:19:27
Speaker
then I don't really have to worry about finding the perfect piece of gear that does what I want, that I can trust will be around. It's such a niche thing because most of the bands that do this sort of thing either have somebody that can be more dedicated to the laptop or they have like techs. So one of the bands we played with obsolescence,
00:19:58
Speaker
they have like a very cool backing track rig that I've geeked out endlessly with their singer about. But he's the lead singer. He's not playing an instrument. So he tends to go over and be like, okay, you know, if something goes wrong, he can kind of dial it in like in between
00:20:25
Speaker
In between the vocal performance, when you're holding a bass, that's like, I need to go over to the laptop. It's like, it's not going to work. I feel like singer or drummer would be a very good laptop monitor. I feel like the laptop works really well for him.
00:20:48
Speaker
Oh, I did notice during their last show, there was some technical issue. Oh, I didn't even notice. It was, it was not with the in ear rig. I think it was with one of the guitarists and he, the singer went over and he was like fiddling with it and fixed it. So I was like, this man is just the overall band tech. He handles it all. I was impressed. But anyway, so are there really no other hardware players now?
00:21:19
Speaker
There are a few. There's the Idoru P1. I have a feeling Symatic was the bottom of the line in terms of... It's all uphill from here, right? Well, sort of. Okay. There is one that is not going anywhere, but it's a bit of a different ballgame. I linked you to idoru.live.
00:21:48
Speaker
So this is a six channel pedal. I believe it's six channels. It says right here on IDORU.live, a laptop is not designed for a live music environment. Yeah, I agree. And I actually like this. Oh, and it's, well, it's out of stock, but it's just under $600. Yeah. It's,
00:22:15
Speaker
Not cheap, but you know, I don't think that these things would be cheap. But the issue for me is having six outputs. Yeah, we need more. Not only that, I want this. Like I want a multi-pin connector. I do not want to plug six things in at the start of every show. I want to plug one thing in at the start of every show.
00:22:41
Speaker
And without doing a multi-pin connector like this, and for audio listeners, this is a bayonet style circular multi-pin connector. You're either going to be doing a DB25 like serial connector, which is fragile, or you're going to have something hardwired, which is sort of unacceptable.

Exploring Hardware Alternatives

00:23:05
Speaker
All right, I found another one.
00:23:09
Speaker
play audio 12, it does 12 tracks. And that is 800. Nice. This is not quite what you think it is. It is intended for that purpose. But as far as I can tell, this is meant to be driven by a laptop. Well, it doesn't help. I think it shows it between two laptops.
00:23:39
Speaker
Yeah. Well, if you're just going to do that and you just get an audio in her face, who cares? Yeah. It's, it's interesting. Like you could potentially use it as the thing that the raspberry PI connects to provided that it's a class compliant. Let's see. It says USB audio 2.0 and USB mini 1.0 class compliant. You could use this for the, uh,
00:24:08
Speaker
for the Raspberry Pi. OK, so just to recap, you to replace your to have a cheap. Multitrack audio player for like. Backing tracks. You have made a you can now use your Raspberry Pi to do it, provided you have the audio interface piece you need.
00:24:38
Speaker
Yes. And it's compliant, which should say somewhere. A lot of things are nowadays. There are two other products, by the way, that I know about. And one of them is real weird. And you could almost not even find it. Yeah, what the hell is? Oh, it's
00:25:02
Speaker
Is it JoCo? JoCo is the, is the one I was going to go to last, but since I can't find the other one, let's go. JoCo, go ahead and look up the JoCo prices. Cause I know exactly what you're going to say now. I can't put where to buy. They don't even have the prices. That's not, that's not good. By all accounts, the JoCo stuff looks solid, but there's, there's a problem for me that has nothing to do with the price.
00:25:32
Speaker
Yeah. These things are thousands of dollars. Sweetwater has them for $2,494. Yeah. But there's another issue. It doesn't do MIDI. Oh, you're right. But it does have that thing you like with the, uh, uh, I don't know what the connection connectors are called. Oh, DB 25. Yeah. Oh, it has MIDI in that doesn't help.
00:25:59
Speaker
That's so like the Behringer X 32 that median is only for control. Oh yeah. I don't, the, the X 32 wears me out because I don't, I don't understand why it has that fucking MIDI. Well, as far as I know, you track 32 card for the X 32. Yes. Which I bet has many out. That's true. Yeah. I wonder.
00:26:26
Speaker
Not that that makes any difference. It doesn't help anyone right now. The other one is this product. It's, I want to say it's called like the something like the be live. Oh man. No, no, no. M live be beat the M live be beat backing track player. I got Michigan basketball.
00:26:55
Speaker
Is it BB or is it? I found it. Yeah. Yeah. Now this is, I believe this is an Italian company that makes this boy. Yeah. This, this is interesting. Actually it,
00:27:16
Speaker
Could potentially work. Cuesto Saito Utiliza e Cookies. Ciao. Cuesto Sito Web Utiliza Cookie. Asensiale per get. All right. All right. I'll stop. Like this product could potentially fill the niche that we need, but it's not. It's not really purpose built.
00:27:44
Speaker
So it doesn't really do what you want, which is, I don't think that's a problem. It's just there really isn't anything in this market that's like even remotely accessible. So I forgot to tell you one thing that I did with the Amtrak player.
00:28:12
Speaker
You know, open source licenses. Yes. There's various ones. One of the more restrictive ones, at least in terms of what you could do with it commercially, is GPL 3. You can still do commercial stuff with it, but like, you know, if you're a company, you kind of want it to be lesser GPL, like LGPL, because you can
00:28:37
Speaker
more easily just kind of use it. So I made mine GPL3 sort of on purpose. Yes. Companies aren't going to scoop this up, but people can use it, I'm guessing. Yes. And that's sort of exactly like what I would want is if you're a band, just go use it. If you want to productize it. Go fuck yourself.
00:29:12
Speaker
I have no issues with bands, even big bands. It's like if you want to roll your own shit, go for it. I don't want anybody to take this and
00:29:31
Speaker
make a company out of it that would make me very upset. Not that as far as we can tell, it seems to be a very lucrative

Future Plans for Amtrak and Lighting Equipment

00:29:44
Speaker
hardware line. But yeah, the last thing that I would love to do, just thinking out loud, is add in a DMX engine into the backing track player itself. Nice. But the issue here is the fact that there is no DMX file format.
00:30:13
Speaker
I can make one. That's fine. But I have no editor for it then. So then I have to make an editor for it. And that's basically going to look like a MIDI. It's going to look like a MIDI editor, but with like twice the bits for value. You know what I mean? It's weird. So I don't know how I would generate such a file.
00:30:40
Speaker
I wish there was just a DMX file because most of the DMX stuff, and for listeners, DMX is lighting, is a lighting protocol. So, Isenmoor has its own lighting show now that's basically done. Sweet. I forgot that's coming back. Yeah. For these shows, we couldn't have
00:31:05
Speaker
It's a different podcast, but for a bunch of recent shows, we couldn't have our light show or our true backing track player. We could have it in our ears, but that's it. I have news for you, by the way, lighting wise. Well, offline news or online news? Oh, it can be online.
00:31:31
Speaker
So what, one of the pain points of setting up our lights is wiring. Yeah. I don't think that'll be a problem. There's no wires. The wires are gone. Including, including plugging in, uh, including they all have their own, uh, fission reactors. I went and got a,
00:32:00
Speaker
Nice set of wireless battery-powered lights. Wireless wires. Well, cool. I'm looking forward to using them. And the nice thing is that- They're being illuminated by them. Yeah, once the lights start working again, instead of being like, okay, we got to go get there way early and then
00:32:24
Speaker
plug all the wires in and then put the brain right where it needs to be so that it'll just be like, just put the wires up or just put the lights there. And we're done. And we're done. Nice. Looking forward to that. Yeah, me too. All right. That's about it. I mean, let's end on the, the, the good news then. Yeah.
00:32:50
Speaker
All right. All right. Well, until next time, Metal Nation, make sure your backing track players are hardware based so you don't have to let go of your guitar to fuck with the computer because it's a mistake we've made. And it's a mistake I've seen other people make and just stop making the same mistake and download Mike's thing and you'll be good unless you help me help me make it better. Yeah. Make it more better.
00:33:27
Speaker
If anyone got this far it's because they wanted to write that in the comments, but I beat them to it.