Guess who wins in signed vs unsigned integer conversion? I guessed wrong today, or rather, I’ve been assuming wrong for quite a while.
consider this example:
int countdown = -1;
// ... (fill the vector)
if (countdown < myVec.size())
countdown++; // this will never get hit
myVec.size() returns size_t, which is an unsigned int and countdown is an int, so to compare these two, the compiler will implicitly cast. You will get warnings when you do this kind of comparison, so listen to them. I assumed in the conversion of primitive values, signed int has precedence. That line casts countdown to an unsigned int, meaning that it has a very high value (0xfffffff), so the conditional is always false.
So the if statment was evaluating to
if ((unsigned int) -1 < 1) // pretend there is 1 element in the array
if (0xFFFFFFFF < 1) // false (same as UINT_MAX < 1)
The correct code then is:
if (countdown < (int) myVec.size())
countdown++; // this will now be run
Here are the rules for implicit type conversion from the C99 standard:
18.104.22.168 Usual arithmetic conversions
If both operands have the same type, then no further conversion is needed.
Otherwise, if both operands have signed integer types or both have unsigned integer types, the operand with the type of lesser integer conversion rank is converted to the type of the operand with greater rank. Otherwise, if the operand that has unsigned integer type has rank greater or equal to the rank of the type of the other operand, then the operand with signed integer type is converted to the type of the operand with unsigned integer type.
Otherwise, if the type of the operand with signed integer type can represent all of the values of the type of the operand with unsigned integer type, then the operand with unsigned integer type is converted to the type of the operand with signed integer type.
Otherwise, both operands are converted to the unsigned integer type corresponding to the type of the operand with signed integer type.
I don't understand the statement after the bold section. But it is clear that unsigned types have precedence over same ranked types.
This conference, organized by the Asia Computer Music Project, which has the aim to bring the communities of computer music from Asian countries, was held on Dec 16-18, 2010, making this post exactly a month tardy.
Pipa performer En-Ju Lin (Taiwan) and Biwa performer Kumiko Shuto (Japan) end the concert with their related instruments. Photo: Michael Cohen
The conference was held by Tokyo Denki University, organized by Naotoshi Osaka, under whom I studied in 2006. I visited Osaka-sensei last year, when he told me about the situation that led him to start the Asian Computer Music Project. There is the phenomenon in Asian academics where there is a culture for domestic (as opposed to international) communities within a field, but when it comes to international communities, the Asian countries tend to not be involved with their Asian neighbors, and look directly towards western nations to be involved with. I can only speak with limited knowledge within my limited academic experience, but even within computer science, the ‘prestigeous’ organizations like IEEE, ACM, and journals like Nature tend to be organized in the West. Looking at the case for computer music, if we look within the International Computer Music Conference, more than 90% of the conferences (since 1974) have been in Europe or the U.S. There is no problem or unfairness in this fact itself, but if as a result it causes Asian countries to ignore their neighbors who have the same interests, this is indeed a disappointing and sub-optimal use of geography when these countries could thrive off each other. The Japanese case is interesting, due to it’s island nature and politics of isolation. Osaka-sensei is always trying very hard to bring people of like minds together, being a believer of community, so it seems like a natural choice for him to do this. I personally am very interested to see how this project works out.
The conference in December was actually the third event organized by the ACMP. The earlier ones were in Geongjyu and Daegu, Korea. Seongah Shin (Keimyung University) organized and hosted the previous meetings at her institution, and was also present at this one, giving a performance for experimental film and music.
The number of attendees for the lectures was small, as you might expect for a new organization, which gave the conference an excitement that is perhaps appropriate for its potential.
The paper topics covered (pdf proceedings here) ranged from Ligeti etude analysis (which gave some interesting insights into Ligeti’s thoughts on the limitations about how much of interesting visual concepts can be transferred to music by former Ligeti student Mari Takano (Toho-Gakuen Arts Tanki University, Bunkyo University) to User Experience regarding the expert user’s problems in comptuer music programming such as SuperCollider, given by Hiroki Nishino (National University of Singapore). There were many other talks I had interest in. I was very surprised and intrigued to have seen Koji Kawasaki asking questions from the audience, author of a well researched bible-sized text on Japanese electronic music (日本の電子音楽). Richard Dudas (Hanyang University), composer and former Max 4 programmer (yes, implementation side), gave a piece and presentation which used a very nice technique to manipulate timbre via filling and removing the gaps of harmonics and playing with the odd/evenness of the resultant spectrum, which does a very convincing range of saxophone to clarinet. There was also an awesome talk and demonstration on controlling music via brain wave sensors by Takayuki Hamano that managed to do the brain sensors without the icky gel stuff. Hiroko Terasawa is also working on sonification of videos of my second-favorite microorganism after the tartigrade, which would be c.elegans, (I spent a lot of time debugging code for multiple sequence alignment for this critter). I once tried to do sonification of video but it was too hard for me to get a perceptual resolution that is anywhere near the visual one so I gave up. Here’s hoping she continues to work with sonification.
The night concerts were in a large hall and were well attended. As you can see from the picture there was a Taiwanese piece by composer Chih-Fang Huang (Yuan Ze University) for tape, performed by En-Ju Lin (Heidelberg University) on Pipa. The first night featured the energetic pieces of younger Japanese composers such as Azumi Yokomizo and Yuka Nakamura who are students of Yuriko Kojima (Shobi University) and Shintaro Imai (Kunitachi College of Music) respectively. Imai also had a playful video piece doing what hi-def does well, focusing on the micro level. Also I was happy and surprised to see Takayuki Rai, (Lancaster Institute for the Contemporary Arts), and whose music I am a fan of was also there and I got to enjoy his piece and shake his hand.
When I am moving cities I find myself focusing more on how communities function. Since I’m planning to go to Japan soon and wish to maintain my academic relationships I hope that I get to see this project evolve. That’s all for now.
This is a basic outline that I will expand on. I just finished debugging this stuff and want to write the main points before I forget my references and main issues.
Summary: two basic gotchas of full duplex (record from mic and output to speaker) audio IO on the iphone that I ran into are:
The AudioUnits IO callback requires you to handle input buffers and output buffers in a very different fashion for each, whereas in the easy to setup core audio callback I used on OS X, they were handled in a similar fashion (both buffers as parameters to the callback). As they are buffers, mishandling them as I did caused my program to crash. Solution: use the parameter buffer for output, and AudioUnitRender() to obtain the input.
Sometimes my callbacks were working, verified by my printf debug statements, but no audio output could be heard – the speakers were silent despite a perfectly good-looking setup and debugging session. Cause: DC output or some other condition caused the iphone speakers to go into a muted state even when volume was on. Solution: plug and unplug a headphone.
When recording from the mic the audio will default to the headset speaker by the earpiece instead of the large and much louder main speaker by the dock. Cause: this is an apple default. Solution: Use AudioSession API to change the default.
Read on for the details.
I’ve implemented Audio IO using the native API on a few systems including old mac (pre OS X), new mac (Core Audio), and Windows. But since then I’ve been getting lazy and just using portaudio for everything, since it does what I want and gets a reasonable latency in most cases.
I just finished implementing my audio IO for an iPhone app I’ve been working on, and I somehow managed not to kill myself. The documentation is not very good, but I don’t think that’s the main issue I was running into. What lost me about 10 hours of time was a few gotchas that I hope writing here will save others some time.
To start off, I wanted a reasonable low latency audio IO with callbacks like I am used to. On the iPhone it seems you need to use AudioUnits for this.
At first I tried to implement an AudioGraph with a Mixer and a RemoteIO audio unit in that, but after a while I realized I could just use a single RemoteIO and no graph. See this site by Michael Tyson for more info. This one will show you how to set up an audio IO mic-in headset-out RemoteIO unit that is probably suitable for most applications that need recording. However I needed to modify it a bit for my purposes.
There are a number of other useful sites for introduction to iPhone audio IO including:
Tim Bolstad made a pretty legit and working (I used this to start) audio IO example that uses Audio Graphs. As I said, this was over-complicating my situation so I stopped using this, but if you need more than a few AudioUnits, this is the way to go.
AurioTouch is a pretty thorough example by apple, but due to its complexity I recommend the above two guides first.
Nobihisa Nagano is a Japanese guy (that is also a supercollider user) who can provide a different approach to AudioUnits if you happen to read Japanese. Perhaps google translate can also help you here.
It’s actually getting quite late, so I’ll stop here for now and hopefully continue later.
Today I had to publish an iOS app written in actionscript. There are a number of almost good guides like this one, which would be good if they just had more pictures.At first I used Flash Builder 4.5.1, which didn’t do the trick. I then used CS 5, and had everything building and running fine via the emulator. But when it came time to publish after generating the provisioning profile it just wouldn’t work. CS 5 kept saying “could not access the digital certificate. could not load keystore file (password may be incorrect)”. I recreated the .p12 file over and over and checked that I was using the distribution certificate instead of the dev one.
Eventually I thought maybe that my password was too complex, having characters like ‘!’ and ‘$’, but these are normal password chars, so I just stupidly assumed that this was not the issue. An hour later after still having no solution I changed the password to simple alphanumeric chars, and it worked. I didn’t see any google links from my searches that lead me to this fix, but I’m posting it here. This is a pretty lame bug, adobe.
After almost exactly two years, I’m moving out of Berlin, back to Hawaii before my probable return to Japan. When I first got here I didn’t know a single person. I came here expecting to work at my academic affiliation, but perhaps because of the school’s financial problems or the change in management upon my arrival, it was hard to even get a desk at the studio (a commodity I had been taking for granted all along.) I worked at a public computer in the lab until classes started — in the same room — which is about the time when I gave up trying to be regularly present at the studio. As a result I did most of my work independently. Perhaps because of this I met a range of people that extended far outside the academic circle that were doing music or art. I met almost no Germans doing music in this adventure – the vast majority were foreigners like myself who came to Berlin for reasons similar to my own. This combined with my interest in Japan (being Japanese, and not being Japanese,) led me to meet a high ratio of Japanese doing music or art.
When I first got here I googled the Japanese in Berlin subject a bit and found Momus’s blog post to be insightful and helpful. In case my own experiences might help others I would like to go over my impressions and findings with respect to the Japanese communities in Berlin over the past two years. Incidentally, (as opposed to the method of tracking and stalking,) after taking a second look at it, I now realize that I came to know and work with about half the people on that click opera post. This validates Momus’s statement about the size and consciousness of the Japanese community. By consciousness I am referring to the recognition between Japanese artists here. This is in stark contrast to the humorous observation I have heard several Japanese people report on how Japanese try as hard as they can to ignore other Japanese when overseas.
One thing struck me immediately upon arrival was the educational bias towards the arts. The Japanese I befriended (many who were at a university for arts) cannot be used as a sample, so take this next example as more objective evidence. I I went to Berlin’s TU (Technical University) orientation, where they had a graph of new students by nationality. There were many Europeans (over a thousand), Chinese (hundreds), and Koreans (tens), but only 1 Japanese was listed. This is in stark contrast to my studies at UW and Dartmouth, where there were more Japanese in Business or Engineering than in Music/Art departments. Essentially, in my makeshift psuedo-statistical analysis, the Japanese were more biased towards the geographical specialty than other nationalities. Germany is a country who’s engineering programs are probably quite good, but not the best, so those seeking a phd in engineering would rather apply to MIT or Stanford. I don’t know enough to say anything about German art programs, but regardless, if the previous claim is true, then you can understand why such a mentality would bring more Japanese doing arts to Berlin. A Japanese guy recently told me (somewhat jokingly) that there are so many Japanese guys doing music that if you see one, you can assume he’s doing music until told otherwise. (Also if it’s a girl she’s probably doing art). Of course this is an over generalization. There are many Japanese who just come here on a working holiday visa to experience life in a foreign country without any particular modus operandi.
The range of music in Berlin is wide yet bound. I really have no way of determining if this is just a result of my subjective experience, but I can say that I expect certain types of music in certain areas. For example, I have been to probably around 70 shows in Kreuzberg/Neukoelln, and the number of bands with guitar and drums that I have seen can be counted on one hand. Computer Music, Noise, Electronics, Minimal Techno. These come to the top of my head first.
In December 2009 I went to a concert that Daisuke Ishida organized. I went because the lovely folks at NK said it would be worth my time, and indeed, it was a well done concert. There Steim’s DJ Sniff (takuro mizuta lippit) and EVOL performed, along with Alberto DeCampo, who is a very nice guy as well as a professor at the UdK and develops tools that big noise names like (Florian) Hecker and Karkowski use. What I know of Daisuke’s own music suits my tastes quite well. On one piece I heard the technical synthesis layer focuses on timbre at the signal level (with probably custom oscillators,) and refreshingly crisp control over the movement and development of the piece. Daisuke also does installations including one with digital/media artist Akitoshi Honda, whom I’ve worked on several projects with.
Later I began to work more with Shintaro Miyazaki, who focuses on media theory and also does performances using sonification. Most of these projects are already discussed in other pages, so I won’t go into them here. But it is worth mentioning that Shintaro also put together the organization ‘la condition japonaise’, which has put on a lot of events from music to dance to art exhibitions that involve members of the Japanese community. Seeing an organization that is tied to a culture or nationality is nothing new, but usually the focus in such a case is on ‘ethnic’ or ‘cultural’ events, whereas ‘la condition japonaise’ put on events that were essentially exhibiting the artists for what they were, providing a support base for the community. It was through events like these that I met many non-musician Japanese artists and dancers.
I’ve written about Tatsumi Ryusui quite a bit on some of our collaborations. I met Tatsumi at a concert at staalplaat where a french noise musician (can’t remember his name) destroyed a turntable, and computer musician Tetsuya Hori performed just after my arriving in Berlin. Tatsumi looked like a guy that I should talk to, so I did it, and now I’m his flatmate. I think it is generally true that when you are new to a city you are more willing to talk to people that you don’t know. I’ve moved cities about 6 times now so I understand this feeling. But at Berlin concerts there is something in the atmosphere that makes it even easier to do then it was for me in Japan or the US. I’m not exactly sure what to call it, but I still feel that is easier in general to communicate between groups. That’s not to say the politics and competition in the arts don’t exist – on the contrary, there have also been awkward moments. But I’m an awkward and shy guy to begin with, so maybe this qualifies me just a bit more to be a metric of the ‘openness’ of a city. Anyway, explaining Tatsumi is a very complicated. He is a professional Itallian chef and has a natural knack for understanding certain things that are difficult to explain. Food is one of them. (I still don’t really understand how food works, but Tatsumi has taught me how to make pizza with out explaining it to me). His view on music is also quite mysterious. I could never ask him what it is, and if I did, I don’t expect I would get the answer. But by observing him over two years I can feel that he has the ability to strongly believe in a musical idea without the necessity to explain it. This is in contrast to the academic viewpoint, where analysis and explanation comes before belief, or at least should follow it. But at the same time it is not at all containing the type of anti-academic sentiment I sometimes see in ‘rebellious’ academic musicians seeking to topple the ivory tower. I’ve mostly seen Tatsumi work with guitar pedals and found objects to achieve a certain target, but lately he has been working on some electronics work via circuit bending of preamps that looks promising and reminded me of some David Tudor neural network type sounds.
I’ve also seen a few of Seiji Morimoto‘s concerts at staalplaat. In the shows I’ve seen he uses small and fun gadgets/trinkets, which individually do not create the most interesting music, and manipulates them to cause a dynamic musical texture to emerge, while not being afraid of silence. The visual manipulation of the objects is also very entertaining. In this regard I found some of the elements similar to Kanta Horio’s work.
Shingo Inao is a former student of Takayuki Rai, whose music I am fond of. He performs with a very unique interface to his computer music. The instrument is very large, causing the performance to cover a significant amount of space. The performance is very intimate, and I don’t mean this in a sappy way. If you’ve read my other blog posts you know this concept of understanding the interface is one that I am always blabbering about. The intimacy I’m referring to here lies between Shingo and his instrument – he seems to really understand how it works and what needs to happen next.
There is experimental electronics/computer music, and there is also the club/DJ scene which does overlap. Iku Sakan is a great example of this, as a DJ who uses brave techniques, while also doing shows that use various instruments including his voice or computer based synthesis/modification to yield emotionally rich performances. I actually met Iku in Japan at a concert we both were doing, arranged by some friends from Berlin. At that concert Iku was playing the steel drum. At first I had a hard time figuring out what was so different about Iku. He’s not an academic, and he’s very humble about himself, referring to himself as a ‘record collector’ and ‘just an appreciator of music’, but at the same time he is willing to undertake the challenge of performing with such a wide range of instruments. Bushisms aside, being able to shoot from the gut is a great ability that sometimes I feel like academia can take out of computer music for certain individuals (me). This just makes it all the more hard to pin Iku down as a certain type of performer or artist. This combined with his fluidity between different mediums is what makes his performances interesting.
At first I was planning to talk more in general about the Japanese community, but I feel this post has been come long enough already. For this reason the Japanese visual artists and dancers that make up the community are not described here, but I should say that I find it quite remarkable how interconnected everyone is, between disciplines, with hubs that extend outside of the art venues into Japanese restaurants such as smartdeli. Not speaking very good Japanese, and not growing up in Japan, I feel somewhat like an outsider in this community, but after asking a couple people in the Japanese community about their thoughts on the community and hearing that they felt also like they are outsiders, I now feel like that might just ironically be the way the average ‘community member’ feels within a well-connected community, in the same sense that a fully connected network is an inefficient usage of resources. There are of course many more people I could write about, but I chose to write about the ones I have interacted with or seen most in the light of this feeling, hopefully providing a more or less honest slice of the community space instead of a snapshot, which I should not be trusted to take.