Monday, July 15, 2024

Spin: the death metal disco player | #MagPiMonday

Ever wondered what death metal disco sounds like? This #MagPiMonday, Sean McManus learns that Spin will not only create it, but let you scratch it, too.

My idea was to remove AI experiences from black boxes and put them into the physical world,” says Arvind Sanjeev. “It’s an open invitation for people to forget about the digital world and to try to create something with AI.”

His previous project was Ghostwriter, a typewriter which he converted to use text generator ChatGPT. Humans type their messages and Ghostwriter types its replies onto the same sheet of paper.

He wanted to create a family of devices and was thinking about where else AI has been disruptive. “The latest music AIs have become so good that it’s really hard to distinguish them from a human creator,” he says. “Spin is this curiosity tool that allows you to explore the boundaries of creating music with AI. I took a lot of inspiration from old analogue synthesisers and combined it with a digital vinyl system DVS.”

Using AI platforms, you usually describe what you want in text. “It’s hard for someone who’s using it for the first time to come up with a really nice prompt,” says Arvind. “I wanted to bring as much physicality into this interaction as possible, rather than using a keyboard to type in what you want.”

Play that funky music

At first glance, Spin looks like a record player. In fact, half of it is. The other half is a grid of buttons. One row allows you to select a mood, such as spacey, warm or dark. Two rows set the genre, including death metal, trance and jazz. Three rows are dedicated to sounds. There are instruments (including drums, sitar, and violin) but also the sounds of water, nature and opera. There are no constraints on how many buttons you select, or what combinations you use. If you can’t decide, there’s a random button.

The duration of the music and tempo are set using sliders. Knobs control the volume and speed. “I thought: What are the maximum different kinds of physical interactions I can bring to this device?” Arvind says.

When you press the generate button, your chosen options are used to create music. When it’s ready, the record starts to rotate. “It is a signal or invitation for you to listen to it,” says Arvind, “but in order to listen to it, you need to physically take the needle and put it on the record.” By turning the record backwards and forwards (scratching), you can manipulate the sound.

Leave a light on

Inside the cabinet, Spin houses an Arduino Mega, Raspberry Pi 4, and Behringer audio interface. There is also a speaker and a tiny HDMI screen at the back, connected to Raspberry Pi, to help with debugging.

The buttons have individual NeoPixel LEDs on them (WS2812b) that light up when the button is selected. They’re illuminated in an animated pattern, using the FastLED Arduino library, when the device is switched on, and 3D-printed enclosures act as diffusers for the LEDs.

Arvind prototyped Spin on a breadboard, and then used the open-source design software KiCad to design a printed circuit board (PCB). The PCB was made for him by a company in India.

He chose the Arduino Mega so he could be certain he’d have enough input pins. “I always want a little more freedom,” he says. “I can use extra pins if I want to add something in the future.”

A keyboard matrix library takes the input from the buttons and maps it as if it’s a keyboard. The Arduino creates the text prompt for the AI by combining the words associated with the buttons and the tempo and duration options. The prompt is sent to Raspberry Pi through a serial to USB cable.

Arvind’s Python program on Raspberry Pi sends the prompt to MusicGen, running in the cloud. “At the time, MusicGen was one of the most flexible and creative platforms out there and it sounded relatively good compared to others,” says Arvind. “The other models didn’t have openly accessible application programming interfaces that I could use.”

Spin me right round, baby

To play the music, Spin uses xwax, an open-source digital vinyl system for Linux. This software enables DJs to control the playback of music files using a normal turntable and a time-coded vinyl record. “It gives them the ability to scratch any music,” says Arvind. “Instead of having music in the grooves, it has timestamps. If you listen to it, it sounds like beeps or a sine wave.”

The signal is sent as audio to a Behringer audio interface, which converts it to digital for Raspberry Pi. Xwax decodes the incoming sound into the timestamps to control the music.

One challenge was that xwax uses a graphical user interface and can’t be controlled from the command line. Arvind used a keyboard emulator to simulate the keyboard shortcuts required to load the new track and play it.

The project didn’t run entirely smoothly. “It failed at the last point, when everything was in the enclosure, even though I’d been testing in stages,” said Arvind. “I thought it was a software glitch, or it had something to do with the needle not being sensitive enough now because it had been running a long time. I took everything apart, piece by piece, and tested it. There was a loose contact within the audio jack from the record player that I had to resolder.”

Arvind’s had queries from DJs asking if he’s selling it, and he’s hoping to collaborate with artists in the Bay Area when he relocates to San Francisco shortly. He has no plans to start manufacturing it, though, preferring to do more experiments. “I would be happy to see someone creating their own commercial version,” he says. “That would be a nice thing to see in the world.”

What’s his favourite combination? “I love lo-fi tracks,” says Arvind, “so I always start with a combination of peaceful, hip hop, lo-fi and some piano. But death metal orchestra and death metal disco are really fun to try.”

The MagPi #143 out NOW!

You can grab the new issue right now from Tesco, Sainsbury’s, Asda, WHSmith, and other newsagents, including the Raspberry Pi Store in Cambridge. It’s also available at our online store which ships around the world. You can also get it via our app on Android or iOS.

You can also subscribe to the print version of The MagPi. Not only do we deliver it globally, but people who sign up to the six- or twelve-month print subscription get a FREE Raspberry Pi Pico W!

The post Spin: the death metal disco player | #MagPiMonday appeared first on Raspberry Pi.



from News - Raspberry Pi https://ift.tt/4tW0rqY

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home