Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Used mixxx to do the djing for my wedding last year. Created a collaborative music voting site for the guests, then got all the music and made a mix which worked really well, even going between genres. Had a lot of fun playing with it getting everything ready and it worked with a couple of DJ controllers bought cheaply without any issue.

I even made a little program to read the now playing track from the sqlite database which then allowed the lights to follow the music (for complex reasons I don't have time to explain).

Most importantly it worked on the night without missing a beat.




Can you share the program that reads the now playing track? We use Mixxx at a student radio station and we could maybe try using something like this to show the now-playing track on the website.


Not sure whether that's the correct way but it seems to work. AFAICT, there is no "now_playing" field in the sqlite db - but tracks that start playing are added to the `PlaylistTracks` table. That means that if you started two tracks and then pause one or the other and restart it, no row will be added. Only adding a track from the library and then playing it will add to the PlaylistTracks list.

(Is there a simpler solution I missed?)

  import sqlite3
  import time
  from pathlib import Path
  home = Path.home()
  
  con = sqlite3.connect(f"{home}/.mixxx/mixxxdb.sqlite")
  cur = con.cursor()
  
  def get_track_name():
      global cur
      trackid = cur.execute("SELECT * FROM PlaylistTracks WHERE id=(SELECT max(id) FROM PlaylistTracks);").fetchall()[0][2]
      trackname = cur.execute(f"SELECT * FROM library WHERE id={trackid};").fetchall()[0][2]
      return trackname
  
  now_playing = get_track_name()
  print(now_playing)
  
  while True:
      if (np := get_track_name()) != now_playing:
          now_playing = np
          print(np)
      time.sleep(1)
Edit: FWIW, unbox [1] uses the same approach. Edit 2: yes, I should have cleaned up my SQL statements.

[1] https://github.com/erikrichardlarson/unbox/blob/2182f227a0fc...


I will see... Not being evasive but I'm experiencing terminal illness at the moment so I'm all over the place. It wasn't a complex bit of code though, but I'll see what I can find.


So sorry, brofus. My best to you and yours.

Also, your channel is fantastic. You’re a good teacher and your voice is excellent.


Wishing you well - sorry to hear that you're in ill health.


Thank you. Sorry, I had a look but I didn't find the code (it's not in the github repo for the rest of the system I made, and I no longer own the laptop I wrote it on so it's my bad).

Someone has posted something similar, but it was literally just about 10 lines of python that read the right key in the dictionary and then posted that to a flask web page that another part of the system read to know what track was being played. I'm not a great programmer and it took me maybe 15 minutes to do, so it should be easy enough!



I have not used Mixxx nor do I have it installed, but might download to check it out.

But..... If its always in a SQLite DB you should be able to use DB Browser for SQLite to inspect the DB Schema and then write a bash/python (whatever) script to pull the info out.

RESULTS=$(sqlite-utils "data.db" " SELECT song, artist, duration, FROM my_table WHERE song = 'CURRENT';")

RESULTS=$(sqlite3 data.db <<EOF SELECT song, artist, duration, FROM my_table WHERE song = 'CURRENT'; EOF )

I have no idea what the schema looks like but those are just some examples of how straightforward it might be. Run it on CRON (whatever) update as needed. https://cronitor.io/guides/python-cron-jobs

Once you have the Schema an LLM could most likely do the rest if you are not a programmer, but still need someone to get it added to the site.


What did you use for the collaborative music voting - or did you make something yourself? For different use cases, I've seen everything used from collaborative Spotify playlists to Google forms, to those "pay a dollar to bump your song request" kiosks in bars! The parallels to ranked-choice voting in politics are relevant too - as well as how you give people a feeling of agency, even if you as the DJ inevitably have veto powers.

I'm not surprised that startups haven't tackled this, as you inevitably run headfirst into licensing issues - but I'm curious what exists in the open-source world for this!


I made something custom. I can't share the code for it (see my other reply for why), but here's the general deal:

Wedding website was a django site, with accounts for everyone I invited. I had a separate part of it where the guests could choose an RGB colour, and then choose tracks by searching. I used a spotify API for this, so when they chose a track, if someone chose a similar one (say a specific mix) then they could see this and vote for that. Each guest could choose 10 tracks. I used some HTMX for this as well (first time) and it generally worked pretty well. Database stored the spotify ID/UUID/whatever for each track

Once everyone had voted, I then bought all the tracks which we were going to play - reason being that I couldn't rely on WiFi on the day, and wanted to be 100% sure it would work, plus I couldn't "DJ" from spotify tracks.

All of the tracks were then renamed including their spotify ID/UUID/whatever, so the system knew who had voted for a specific track.

I then made the playlist up in Mixxx, and trimmed tracks to fit better, and made it work musically (my wife is excellent at this, she made it really work, mix wise). Made sure it all played OK.

The other part of the system was a custom light setup, with sound-reactive LED bars I made up (using ESP8266 and WLED firmware with 150 LEDs per 'stick') with them all being controlled by a custom controller. This system read the track from the Mixxx system (via HTTP request to a flask app I wrote that read the sqlite dB from mixxx to know what track was playing), and then coloured the lights with the colours of the people who had voted for the tracks. Also if you went onto the dancefloor you could 'swipe in' via an RFID label which was in the wristbands, which also reacted to lights and were colour-controlled over DMX.

The light patterns were sometimes random, or if one was good for a specific track then I programmed that into the system.

It was all spaghetti code, and the first time I used FastAPI. The code is terrible, and I'm only making it public as I thought it might be useful to someone.

https://github.com/djaychela/wedding_controller

I've just had a terminal cancer diagnosis and am no longer doing anything other than trying to stay alive. So please, no grief about the code! I'm sharing this to try to help someone else if they ever want to do something like this...


Thanks for sharing this - it’s a really cool project! I love the creativity and thought you put into combining music, lights, and interactivity in such a unique way.

Wishing you all the best, and thank you for contributing to the community with this, especially under such difficult circumstances.


Best wishes on your fight. When I was facing a near death situation my now wife used Creative Visualization. She pictured us walking on our favorite walk in our local park with ducks, which I love to watch. https://en.wikipedia.org/wiki/Creative_visualization It can also be used to help focus your immune system. These suggestions are to be used combined with evidence based medicine not as an alternative.


> It was all spaghetti code, and the first time I used FastAPI. The code is terrible, and I'm only making it public as I thought it might be useful to someone.

Dude, that is the true hacker spirit - I am a programmer and frankly that setup you described is more creative than anything I have ever made.

Fight on and keep at it - best wishes to you and your family!




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: