Drum Machine - napisany w... Excelu. Twórz muzykę w arkuszu kalkulacyjnym (film - 15 minut)
Dylan Tallchief to twórca, który łączy świat technologii z muzyką w nowatorski sposób. W swoim najnowszym filmie na YouTube dzieli się ze słuchaczami niesamowitym projektem – automatem perkusyjnym stworzonym w programie Excel. Choć wielu z nas może postrzegać Excel jako narzędzie do obliczeń, nie każdy zdaje sobie sprawę, że może służyć również do tworzenia dźwięków i muzyki. Wideo, które przyciągnęło już 681651 wyświetleń, pokazuje, jak w prosty sposób można korzystać z arkuszy kalkulacyjnych, aby zbudować coś, co przypomina złożony zestaw perkusyjny. Dylan obrazuje, jak w każdej komórce można umieścić 'X', które odpowiada za przypisanie dźwięku, co czyni ten projekt jeszcze bardziej fascynującym.
W swoim przekazie Dylan zwraca uwagę na dwa przyciski odtwarzania, które pozwalają na tworzenie różnych wzorców rytmicznych. Użytkownicy mogą zmieniać prędkość i wysokość dźwięków, co daje im możliwość dostosowania utworów według własnych upodobań. Interakcja z automatem perkusyjnym jest niezwykle prosta, a dostępne opcje pozwalają na nieograniczone możliwości aranżacji utworów. Ponadto, Dylan porusza temat MIDI, wyjaśniając, że może wysyłać dźwięki do innych programów takich jak FL Studio czy Ableton, co czyni ten projekt wielofunkcyjnym narzędziem dla muzyków.
Konstrukcja automatu perkusyjnego w Excelu zdaje się być doskonałym dowodem na to, że ograniczenia są często jedynie w naszej wyobraźni. Dylan opisuje swój proces uzyskiwania dźwięków, zwracając uwagę na wyzwania związane z programowaniem i kodowaniem w Visual Basic for Applications (VBA). Mówi o potrzebie testowania, poprawiania błędów i dążenia do optymalizacji projektu, co pokazuje jego zaangażowanie i pasję do muzyki oraz programowania. Dzięki temu, projekt jest nie tylko innowacyjny, ale również inspirujący dla każdego, kto marzy o stworzeniu własnej muzyki w nietypowy sposób.
Interfejs automatu, mimo że może wydawać się skomplikowany, jest dostosowany do użytkowników, którzy mają pewne zrozumienie tych technologii. Widzowie mogą łatwo zaimplementować własne próbki dźwiękowe, co z pewnością przyciągnie wielu kreatywnych zwolenników muzyki. Dylan podkreśla, że każdy może w prosty sposób stworzyć własne utwory, co czyni ten projekt jeszcze bardziej dostępnym. Warto również zaznaczyć, że automaty perkusyjne, takie jak ten, mogą pełnić różnorodne funkcje, poprawiając proces twórczy dla muzyków.
Na koniec, ważne jest zauważyć, że film Dylana Tallchiefa nie tylko zdobył popularność, ale również przyciągnął uwagę wielu muzyków i entuzjastów technologii. W chwili pisania tego artykułu, liczba wyświetleń wyniosła 681651, a liczba polubień to 19872. To dowód na to, że Dylana wizja tworzenia unikalnych doświadczeń muzycznych w nieoczekiwany sposób zdobywa rzesze fanów. Dlatego, jeśli ktoś jest zainteresowany bardziej nietypowymi sposobami na tworzenie muzyki, jego projekt automatu perkusyjnego w Excelu z pewnością dostarczy nie tylko rozrywki, ale również inspiracji do dalszego eksperymentowania w świecie dźwięków.
Toggle timeline summary
-
Dyskusja na temat mema o tworzeniu piosenki w Excelu i jak jego arkusz przypomina wzory w DAW.
-
Wzmianka o demonstracji ray tracingu stworzonej w Excelu, podkreślająca możliwości Excela.
-
Wprowadzenie do używania Excela jako maszyny perkusyjnej, zaczynając od przycisków odtwarzania i wpisów wzorców.
-
Wyjaśnienie działania maszyny perkusyjnej od kuchni oraz dostępnych kontrolerów.
-
Szczegóły dotyczące zarządzania nutami i wzorami perkusyjnymi, w tym regulacja tonacji i głośności.
-
Wprowadzenie do zarządzania wzorcami w Excelu: nazywanie, kopiowanie i wklejanie wzorców.
-
Wyjaśnienie ważnych ustawień, takich jak BPM i wybór urządzenia dla maszyny perkusyjnej.
-
Wyjaśnienie użycia MIDI zamiast próbek audio dla większej elastyczności.
-
Instrukcje dotyczące podłączania do urządzeń MIDI i używania wirtualnych portów MIDI z FL Studio.
-
Przegląd ustawień pętli i przypisania programów dla różnych dźwięków perkusyjnych.
-
Dyskusja na temat ustawień swing i aranżacji sekwencji dla zmienności wzorców.
-
Refleksja nad historią maszyn perkusyjnych opracowanych w Excelu i poszukiwanie przyjaznych dla użytkownika alternatyw.
-
Wprowadzenie do aspektów kodowania w Excelu związanych z VBA do tworzenia sekwencji.
-
Eksploracja metod synchronizacji i czasowania bitów w maszynie perkusyjnej Excel.
-
Osobiste wspomnienia o pracy nad projektem przez dwa tygodnie i przyszłe rozwinięcia.
-
Podziękowanie patronom, którzy wspierali projekt oraz wyrażenie wdzięczności.
Transcription
🔪🔪🔪🔪 You may have seen that that meme of someone making a song in Excel. It makes a lot of sense. The worksheet form of Excel does resemble a lot of patterns and clips in DAWs. I wouldn't say that's necessarily a reason why Is it because I saw a meme Recently, there was someone who made a ray tracing demo in Excel. If you can do that, then you can pretty much do anything in Excel at that point, as you can see. Hell yeah. So I'll run through how this works in case you want to download it and use it yourself. And then afterwards I'll kind of go into the behind the scenes workings of the drum machine. So we have two play buttons. The main one, I would say it's just play pattern everywhere you see a cell. You can just put an X down on the side. You have like these little plus points. It will unfold hidden rows where you can like change the velocity and pitch of things. The number 60 is the default C5 that FL Studio plays notes at. So anything higher is going to be sound high pitch. Anything lower is going to sound lower pitch. And if you have nothing here, what it will do is just look at the side. It's nicest way because it means you don't have to write out the velocity and pitch for every single note. And if you click one up there, you'll minimize everything or you can click the two and everything unfolds. The names don't do anything, so you can just name it wherever you want to. On the left side, we have patterns with different names, different losses, different everything. But then at the bottom we have open, which is essentially for infinite amount of patterns. You could open up pattern 10. These ones, once you go above seven, like they don't have any names because they just haven't been assigned yet. So the pretty empty looking here, let's say you wanted to quickly add some names there and other notes where you can copy stuff and paste things. You can go to pattern one. Hey, let's get pattern one. I want to copy this to pattern 10. Open up number 10, paste that. Whoa. The nice thing about these buttons is that if you're playing it, then you can change the pattern at any time. However, if you like edit whilst it's playing, then it just gets stuck. It just stops all scripts. So don't do that. If you do though, you can just like press play again. Let's say we want to get rid of everything because we don't like it anymore. Bam. We're clear. Then we have some options up here. These are very important. BPM. That's self-explanatory. 200. You know, reasonable tempos, even 200 safe, even 300. You're probably fine, but just don't do anything stupid. Device. So this is important because we're not really playing audio samples in this drum machine. I did try it. That was the original intention and it almost worked. This is, this is kind of the beginning of my whole coding problems. Even if I had gone that route, it would have been a little awkward because if I'm using certain samples, you're not going to have those samples. So we have to like link back to them. See the benefit of it being MIDI now is that I can send it to where I want and it's very easy to swap out samples. So that's what device is here for device. We'll send it to a MIDI port on the computer, even though it sends MIDI by default device. One should be the Microsoft GS wavetable since that's already on your computer by default, you don't need any hardware because if you just use one, then you can just play MIDI sounds and each note, instead of it being like an actual pitch, it just chooses a different drum sample. So 35 kick and 38 is a type of snare. There's different snares. Which makes it feel like its own standalone program. I like that. But if you do have a device, then you can send it to those places. So I'll kind of explain that right now. You'll probably want to start at two and go up. So if you have an interface, whatever number your interface is on, then you can play this and the MIDI will be sent to the interface, that MIDI will go out. And if you have like an actual drum machine or synths or whatever, you can plug it in and you'll be playing it from Excel. What if you want to send it to Ableton or FL studio? You want to try a virtual MIDI port. I think I would advise loop MIDI, but loop B one, it's also a possibility when you have a loop port open, then one of the numbers will be one of the ports. And the nice thing about loop MIDI is that you can even see when data's coming in. So, you know, it's working, you know, it's receiving. So then you just need to go into FL studio. You want to go to your MIDI settings. So you're like, wow, a lot of MIDI devices and that's loop B. Make sure it's enabled. You don't need to send it to an actual port. Now the notes will go to FL studio. Next part is loops on these settings. Pretty self-explanatory. I actually just removed prog mode because I realized it was kind of pointless. For every track, it will send it to a different program. So this is program one, two, three, four, five, six, seven, eight. When you send a note to program one, whatever is in this position, the top position is going to play. If you're sending a note to program two, then the clap will play. And if you like swap these around, the hat will play instead. So it's just like a top down order. That's why the names don't really matter. All it is, is the position. This doesn't care what channel it is, but for Ableton, it's the opposite way around. Here you can see all the notes going down to channel eight and then repeating again. So what do you want to do is then select the input to channel one. You also want it to tell it to set that to input to receive MIDI. Otherwise it just kind of ignores it and then you're done and then you can put a sample there. Then we have swing. My swing setup is pretty janky. I will admit, essentially it's just, if you put it to one, you'll get some swing. If you put it to two, you'll get a lot of swing. There is a sort of arrangement sequence list. You can have multiple sequences. This is just one, two, three, four. So if I play that. You also have this open button. So essentially you can also have infinite sequences. I wouldn't put it really high though. Cause I did that once like to 5,000 and it actually crashed the program. That's just an Excel thing. Then I guess it plays through one to four. Once it gets to four, it will just stay at four. So you can have like remaining loops left over. It will just stay unless you type in loop. There you go. Then once he gets to four, it'll just start all over again. Or instead of typing loop, you can type just L that will also loop. I put that one in there for the time savers. I want to see what you can do with this. You can essentially with this whole sequencer, make a full song. I bet it would be tedious, but you can do stuff. You can make this because you can use any drum samples. You can use 808s. You can even use synths. There's velocity, there's pitch. You can just draw in melodies. I'm not even the first person to come up with the idea of doing a drum machine. Whilst working on this, I did look to see if anybody else had done something similar. Like back in 2005, someone did this, but the code just doesn't work anymore because it was written for like 32 bit applications. And then I found essentially a whole DAW built in Excel with individual sequences and arrangements. However, the user friendliness is not very high on this. And even the latest version wouldn't open and work properly. So I had to go to like a really old version. And I could like see how it worked, which was very, very important. Took like a couple of days just to understand what is going on in the code. So let's start to really reveal the inner workings of this. First off, how it saves. This whole space copies it to another worksheet over here. Let's say I have, I want to open pattern 10. This is 24 cells high. So what I have to do is times 10 by 24. That's where this pattern will get stored to and retrieved from when you want to open it again. This is what Excel is made for, for storing sheets of data. So it kind of makes sense to use it this way as well. I think it's time for VBA. It's VBA time, is it? Oh yeah. If you are good at coding, there's probably things that will make you cringe. Go to Excel options, customize ribbon and turn on the Excel tab here. Then this will pop up developer along all these options. And you can just open visual basic and then you see the scripts. But the main one is this sec for sequence. This is long. This is how many 1200 lines. So I started off with option explicit. This is actually kind of important. If you want to store information like a number or a word, then usually store them in a thing called a variable. What you should do is declare a variable right at the top. And I wasn't doing that for a lot of them. It will still work without, like sometimes you don't need to say I'm making it a variable. I can just do it without declaring it and it will still work. However, I sent it to someone else and they couldn't run it because I didn't declare a lot of these variables. So if you have option, option explicit, then you must declare them or else the code just won't run. It's kind of like a safety feature essentially. Then it comes to these, if windows 64 thingies, you can use things outside of Excel. That was how I was playing the sounds at first. This was using the, the WinMM windows multimedia DLL. It wouldn't play multiple sounds at once. So that was not an option. And then we have the big list of variables that I'm using. A lot of them, you can have functions in VBA, but you're just writing as sub. If you've ever used JavaScript, it kind of just works the same way. I'm creating a big loop. That's just for 16 steps. And once it gets to 16 steps, then another function plays called looper that was like, okay, well, are there any more loops left if there are, well, then we'll play again to get it to have rhythm. You want it to have pauses. Cause if I play this just without any pauses, it would play it like instantly. It would go, I have to like trigger out each step, what that's going to be. So what it does, it takes 60 because there are 60 seconds in a minute, 60 divided by the value from, from this cell, but actually one in milliseconds. So then I times it by a thousand and then I divide it by four. There's four steps for every beats. However, this started to make problems because let's say if I told the program to wait for a hundred milliseconds, it works, but it didn't feel exactly right. I would play it along with a metronome in FL studio, slowly over time, they would start to desync. And the reason is, is that the code takes time. There's like a little bit of delay from every action it has to do. Moving the colors about all that slows it down and increases the delay as it got bigger and bigger to like 20 and 30 milliseconds between each beat. So waiting a little bit longer and over time that will desync. My first idea was to split up the code a lot more. This was all running from one big function. I thought if it has to run through all those lines of code, then before it gets to loop around all over again, what if I split them apart? So they work individually. Essentially what, what happens is like, if it's running through a code and it calls a function, it basically runs through that whole function and then goes back and continues on, they don't work in parallel at all. I looked in the other version and what they were using was a timer system, this windows API thing called time get time. So that the moment your computer starts, it like starts counting. It just gets higher and higher and higher and higher. So if you wanted to wait a hundred milliseconds, like you add that to get time and then get time will get higher and higher until it reaches the time you want it to wait to. And the cool thing about that is that. Let's say you need to wait a hundred milliseconds and the code takes delays 30 milliseconds. Then instead of just waiting another hundred, it would actually just wait the 70 instead. It balances itself out. Things were way better in time after that. Well, not perfect though. The timer method that only counts in milliseconds and not half a millisecond. So I needed like something, a higher resolution timer. I found another timer. Someone made a timer that works on fractions of a millisecond, but I knew how to take part of it that I wanted to use and then put it into the code. Essentially. I'm just a script kitty. I just look for stuff. If it works. Oh, cool. Everything you see in sec for the most part, I've written myself. If it's copied over and over again, there's a good chance that I wrote that. Um, yeah, I think that's everything I needed to say. I worked like almost exclusively on this for two weeks. It was kind of addicting to make it better and problem solve issues that I have bug testing, all that sort of stuff. And I won't be surprised if you can find some that I didn't find before, but what are, what I will want to probably work on next is like an arrangement view and then actually turn it into an actual DAW. Just like the meme, exactly like the meme. And I'm making, I'm not making any promises on this. If you want to see more weird stuff like this, you know what to do. Thank you. My patrons subscribers without them, this drum machine wouldn't exist. This is where the hard earned dollars are going towards their funding drum machines being created in Excel, but I'm, I'm super thankful for them. I don't just work in Excel, but also in Apple studio and Ableton. And if you're interested, if you're interested in lessons, I teach lessons.