danilofuchs / ForceTouchPlayer

Play songs with a Macbook trackpad
MIT License
54 stars 5 forks source link
force-touch hacktoberfest macbook trackpad tune vibration

Force Touch Player

https://github.com/danilofuchs/ForceTouchPlayer/assets/17657014/580bffd3-9dd9-4a46-88c4-fe3767380bc7

https://user-images.githubusercontent.com/17657014/225430279-9b77017b-92ab-4ccc-9daf-7f62892f4e92.mp4

Video credits to @fsmiamoto

Do you own a MacBook™?

Do you think the builtin Stereo Speakers™ are too limiting?

Have you realized your Force Touch™ Trackpad is not a huge glass button, but a huge glass vibration motor?

You see where I'm getting at. Introducing the Force Touch Player™ (not actually a trademark)

Play your favorite 8-bit tunes in the trackpad, with the trackpad, on the trackpad. No speaker required!

Screenshot

Wow, very music

Needs macOS 10.15 (Catalina) or later

Jukebox

(that's it)

Whoa, Black magic™?

No witchery here.

Only a very, very bad usage of Creative Programming™

In Brazil, we don't say Programming, we say Gambiarra and I think it's beautiful

It turns out since the 2015 MacBook™ Pro™ with Retina Display™, the trackpad is not a button. It is instead a vibration motor (vibracall), not very different from your Nokia 3310™.

Apple's engineers figured that managing the clicky feel via software would lead to a much better experience and fewer defects instead of the old, outdated™, mechanical switch.

So they did.

They also figured developers would find it appealing for their apps to interact with users with awesome Haptic Feedback™. Clicky things everywhere!

So they did.

They thought people would only use it for good, for the almighty UX™

So they did.

Do you realize what they created? Not only they made a noisy motor, but they also created a way to control it precisely (NSHapticFeedbackPerformer™)

You know what this means? They created a speaker

Well, not really, but we can make it sound like one

Permissions

I don't have an Apple certificate to publish this app the right way. For you to use the app, you must allow this app to be ran:

Allow in Finder™

Allow in Settings™

Contributing

Are you sure?

This can't be right. Really?

Your toolkit

You will need Xcode™ 11+ running on macOS™ 10.15 (Catalina) or later. This project uses SwiftUI with features introduced in 10.15.

Open the project on Xcode and run it using Debug scheme.

There may be some issues related to certificates. Make sure you have your development certificate configured correctly on Xcode.

To create a release build, run Product > Archive.

Is there even a limit?

Who knew trackpads had limits? I could only get it to work until around 220Hz (A3). If you are brave enough, maybe you can find a way to make it less bad™

Adding a new tune

Any flute melody can work, as they only output a single note at a time. I recommend using parts from https://www.flutetunes.com/

Remember to only use the lower keys (B0 -> B2)

Songs can be adapted from arduino-songs. They are already curated and it is pretty much a task of copying and translating C arrays to Swift™

MIDI support?

That would be nice

iPhone™?

🤔