‘When he got stabbed I just thought, we’re fucked. If he is alive, there is nothing we can do.” Brazilian journalist Amauri Gonzo is recalling the moment that he knew Jair Bolsonaro would be elected his country’s president. The stabbing of the far-right candidate seemed to confirm the picture of Brazil that Bolsonaro had been painting to voters: lawless, unsafe, and in need of a leader unafraid to meet violence with violence. Just two months later, in protest at five years dogged by economic crisis, corruption scandals and political turmoil, Brazil chose the openly racist, misogynistic, homophobic and anti-environmentalist former paratrooper as its leader. The underground musical community, which had come out in force against the extreme right candidate, was stunned. “It all went quiet,” says Gonzo, “like, ‘Oh, what do we do now?’”

Brazilian music might bring to mind the warm breeze of bossa nova, or a sound humid with the sweat of carnival, but a group of loosely connected São Paulo artists are making much harsher music to reflect, and resist, the Bolsonaro era, underlining values of community and artistic freedom.

It’s worth mentioning first that the country’s long history of resistance through music runs directly parallel to its past as a colony, a slave state and as a military dictatorship. The 1964–85 dictatorship, for which Bolsonaro has openly professed his admiration, inspired Brazil’s most famous moment of artistic resistance: the Tropicália movement. Encompassing poetry, art and music, it subversively critiqued the regime. The movement was already effectively over when in 1969 its musical leaders, Caetano Veloso and Gilberto Gil, were arrested as part of a crackdown and sent into a three-year exile in London.

Less well known, but perhaps just as influential, are the hardcore and post-punk movements that swirled up in the early 80s as the dictatorship teetered and fell. In recent years, Brazil’s vibrant and vast hip-hop community has found a new voice on issues of race and police brutality.

Brazil’s history of cultural resistance dates back beyond the past century, as Mariano, percussionist in the cacophonous São Paulo trio Deafkids, explains. Samba, he says, was initially a way for his African ancestors to access the heritage from which they had been violently cut off. For him, the roots of Brazil’s current trauma date back just as far, to conquest, genocide and slavery. “The way we deal with what identity is and what culture is, is really fragmented. This becomes more explicit in moments of polarisation, like right now.”

Deafkids’ 2019 LP, Metaprogramação, is a hallucinatory blur of noise that addresses “the politics of who we are, in terms of what composes us”, says Mariano. But they prefer to avoid the kind of political anachronisms associated with punk. “We are not interested in cultivating nihilism … in cultivating crisis,” he says, explaining that Deafkids’ philosophy is not rooted in opposition. “We are more interested in trying to think of other ways to say yes, of other things and other practices to embrace and other ideas to spread.”

What this means in practice, he says, is bringing back communality to music. He has in mind everything from cumbia and classical Indian music to the radical techno of Underground Resistance, music that has been “shunned as music which is not deep because it is related to the body”. Deafkids, he says, want to engage with the body from the neck down, to make music that is “more transcendental in a less rational way”.

‘It has never been easy to live in Brazil’ … Rakta. Photograph: André Penteado

The body itself is at the centre of post-punk group Rakta’s work. “Being a woman and occupying a space in the Brazilian music scene is a social and political act in and of itself,” says member Paula Rebellato, adding that, in Brazil, a woman is murdered every two hours. For them, Bolsonaro, who opposes gender equality and once taunted a female congresswoman that she was “unworthy of rape”, is an open manifestation of Brazil’s history of misogyny. “It has never been easy to live in Brazil,” bandmate Carla Boregas adds poignantly, but now, because of Bolsanaro and others like him, people no longer bother to hide their misogyny, racism, homophobia “and a host of other prejudices”.

Inspired by the attitude and the activism of the Brazilian hardcore scene of the late 80s and 90s, Rakta refract their experiences of growing up in Latin America’s largest city through droning psychedelia. Boregas says that lyrics by 90s hardcore group Invasores de Cerebros (“São Paulo dangerous city … São Paulo violent city”) spoke directly to her experiences growing up in a working-class neighbourhood bordered by favelas. Their São Paulo is a city of enormous disparities, a “chaotic and vibrating” place where you can experience the “complete raw and hard duality of being a human in a capitalist society”, she says.

Similarly to Deafkids, with whom they toured this spring, unity is at the heart of their music, present in the “strong, intimidating, powerful and mysterious” energy that comes from the female “egregore” (collective mind) of the group. Through their performances, which they describe as “temporary zones of reality that we co-create” with the audience, Rakta want to create islands of sound in a sea of oppression, where “people end up finding a little comfort, and feel hosted and integrated”, says Boregas. The band may not be able to heal literal wounds, but they still have the artistic freedom with which they can ease some of the anxiety and distress that comes with daily life in Brazil under Bolsonaro.

The idea of community as a small breach in an oppressive reality is also at the centre of São Paulo’s underground club culture. Around 2010, a new kind of party began to appear: self-organised, self-financed and inclusive. Often held in the street or in occupied buildings, they represent what Amauri Gonzo calls the proud Brazilian countercultural tradition of the street as both a party and a political venue.

“Everything was born out of a necessity to fill a blank spot in the culture of our city,” says Amanda Mussi, a techno DJ and promoter. But successive mayoral administrations, seeking to clean up the downtown area, have made this harder, applying increasingly arcane and demanding safety regulations that these promoters say are not even met by São Paulo’s more upmarket, commercial clubs. Beyond that, there’s endemic systemic corruption. “It’s not just one permit,” says Mussi. “It’s a permit of a permit of a permit. You have to pay several charges and taxes, but this all goes to someone’s pocket – it’s not real.” The agenda of the mayor’s office is clear for these collectives and activists: a revitalised downtown is simply too potentially profitable to be left in the hands of community organisers. Now that the inner city has life again, it won’t be long before the cycle of gentrification reaches its next step, with property developers moving in to create manicured, homogenised neighbourhoods.

Playful activism … Teto Preto performing in 2019. Photograph: Jesse Hunniford

“We’re an open wound downtown,” says Laura Diaz, a colleague of Mussi, and co-founder of the Mamba Negra collective, São Paulo’s most renowned underground party. The roots of the collective, like many of those active today, can be found in the aftermath of the 2013 São Paulo protests. Initially sparked by an increase in transport fares, the demonstrations would culminate in 1m people taking to the street to protest against corruption, police brutality and a long list of other grievances. These protests demonstrated Brazil’s disenchantment not just with the ruling leftwing PT, but the political class in general. With the sting of teargas still in the air, Diaz, a former student activist, met Carol Schutzer (who DJs as Cashu) and with the help of friends and collaborators, the two set about creating a party in their own image: “a naughty, venomous snake”.

That image is perhaps best represented by Teto Preto, the electronic act fronted by Diaz and sinewy performance artist Loïc Koutana, who merge playfulness with activism: the video to their signature track Gasolina features Koutana writhing and weaving along a line of police in riot gear, a call to ignite the fuel in the hearts and minds of their fellow Brazilians. Both Teto Preto and Mamba Negra are a re-vindication of the spirit of Brazil’s week-long Carnaval street parties: joyously anarchic and riotously flamboyant.

But it’s about more than just dancing. Diaz says the aim was not only to create a safe space where women and LGBTQ people could party, but also where they can become protagonists who are recognised for their work. “We pay our taxes, we want to be respected, we want the right to work and the means to do it,” she says. The ambition behind that statement burns especially brightly in a place where homophobia was criminalised only in May this year, a move swiftly denounced as “completely wrong” by Bolsonaro.

That Mamba Negra and the Bolsonaro presidency were both born out of the smoke and anger of the 2013 protests demonstrates the division at the heart of Brazil. Out of that moment, each saw an opportunity: one side detected the potential for a Brazil that celebrates the country’s diversity, and the other side saw the opportunity to use the chaos to drag the country back to its colonial divisions. That they still haven’t escaped that colonial legacy is an issue that haunts these artists and their peers. But, equally, what keeps them from succumbing to the inevitability of that outcome is also written into Brazil’s history: their faith in the unbreakable bonds of autonomous communities. No leader, no government and no dictatorship has ever been able to fully suppress a culture that grows irrepressibly between the cracks.

A couple of weeks after we speak, Mariano emails me to try to explain what kind of music inspires Deafkids to keep writing. His description could serve as a manifesto for Brazil’s artists today: “Music which carries ‘the heat’, a pulsating will to live, even when at its saddest.”